package study.thread;

public class ThreadTest {

	public static void main(String[] args) throws InterruptedException {
		MyThread myThread = new MyThread();
		myThread.setName("my first thread");
		
		MyThread myThread1 = new MyThread();
		myThread1.setName("my second thread");
		
		MyThread myThread2 = new MyThread();
		myThread2.setName("my thirth thread");
		
		myThread.start();
		myThread.sleep(3000);
		//myThread.wait();
		
		myThread1.join();
		myThread1.start();
		//myThread1.yield();
		myThread2.start();
		
		Thread threadRun = new Thread(new MyRunnable());
		threadRun.start();
	}

}



class MyThread extends Thread{
	public void run(){
		
		System.out.println("Thread:"+Thread.currentThread().getName());
	}
}

class MyRunnable implements Runnable{

	@Override
	public void run() {
		System.out.println("my runnable thread");
	}
	
}

